﻿using ReflectionStudio.Core.Events;
using System;
using System.Data;
using System.Windows;
using System.Windows.Data;
using System.ComponentModel;
using System.Collections.Generic;
namespace WPFExcelReport
{
    public partial class TSKS05
    {
        public TSKS05()
        {
            if (DesignerProperties.GetIsInDesignMode(this))
                return;
            MV = new VKSTAGZUO();
            DataContext = MV;
            InitializeComponent();
        }

        public override void vwMaster_CurrentChanged(object sender, EventArgs e)
        {
            base.vwMaster_CurrentChanged(sender, e);              
        } 

       
        public override void OnEXAUFChg(string vlaue)
        {
            TBMain.Clear();
            if (EXAUF.Length < 6)
                return;
            dwData = TMV.TBMain.NewRow();
            KRS = EXAUF.Substring(0, 2);
            LFD = EXAUF.Substring(2, 4);
            dwData["KSZMANDANT"] = app.Mandant;
            dwData["KSZKSTKRS"] = " AND KSZKSTKRS='" + EXAUF.Substring(0, 2) + "'";
            dwData["KSZKST"] = " AND KSZKST='" + EXAUF.Substring(2, 4) + "'";
            SResult = TMV.QKSZ02(dwData);
            MergeData(SResult, true);
            base.OnEXAUFChg(vlaue);
        } 
        public override void LOADALL()
        {
            OnKSTChg(KST);
            dwData["KSZMANDANT"] = app.Mandant;
            dwData["KSZKSTKRS"] = " AND KSZKSTKRS='" + KRS + "'";
            dwData["KSZKST"] = " AND KSZKST='" + LFD + "'";
            SResult = TMV.QKSZ02(dwData);
            MergeData(SResult, false);
            base.LOADALL();
        }
        public override void ManageCommand(object sender, RoutedEventArgs e)
        {
            if (IsManage)
            {
                LOADALL();
            }
            base.ManageCommand(sender, e);
        } 
    }

}
